//
//  MyLocation.m
//  DriverBus
//
//  Created by MacMini20170218 on 2017/3/27.
//  Copyright © 2017年 JiYang. All rights reserved.
//

#import "MyLocation.h"

@implementation MyLocation{
    BMKLocationService* locationService;
}

- (void)startLocation{
    if(locationService == nil){
        locationService = [[BMKLocationService alloc]init];
        locationService.delegate = self;
        locationService.pausesLocationUpdatesAutomatically = NO;
        locationService.allowsBackgroundLocationUpdates = YES;
    }
    [locationService startUserLocationService];
    NSLog(@"start location");
}

- (void)stopLocation{
    [locationService stopUserLocationService];
    NSLog(@"stop location");
}
//处理方向变更信息
- (void)didUpdateUserHeading:(BMKUserLocation *)userLocation{
    NSLog(@"heading is %@",userLocation.heading);
}

- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation{
    //处理位置坐标更新
    NSLog(@"didUpdateUserLocation lat %f,long %f",userLocation.location.coordinate.latitude,userLocation.location.coordinate.longitude);
}

@end
